//
// Description: 371. 两整数之和
// Created by Loading on 2021/9/26.
//

#include <bits/stdc++.h>

using namespace std;

int getSum(int a, int b) {
    while (b != 0) {
        // 进位，无符号整型防止溢出
        unsigned int temp = (unsigned int)(a & b) << 1;
        a ^= b;
        b = temp;
    }

    return a;
}

int main() {
    int a = -100, b = 1000;
    int res = getSum(a, b);
    cout << res << endl;

    return 0;
}